<HTML>
<HEAD>
<TITLE>[Chapter 11] 11.3 The Adjustable Interface</TITLE>
<META NAME="author" CONTENT="John Zukowski">
<META NAME="date" CONTENT="Thu Jul 31 14:48:11 1997">
<META NAME="form" CONTENT="html">
<META NAME="metadata" CONTENT="dublincore.0.1">
<META NAME="objecttype" CONTENT="book part">
<META NAME="otheragent" CONTENT="gmat dbtohtml">
<META NAME="publisher" CONTENT="O'Reilly &amp; Associates, Inc.">
<META NAME="source" CONTENT="SGML">
<META NAME="subject" CONTENT="Java AWT">
<META NAME="title" CONTENT="Java AWT">
<META HTTP-EQUIV="Content-Script-Type" CONTENT="text/javascript">
</HEAD>
<body vlink="#551a8b" alink="#ff0000" text="#000000" bgcolor="#FFFFFF" link="#0000ee">

<DIV CLASS=htmlnav>
<H1><a href='index.htm'><IMG SRC="gifs/smbanner.gif"
     ALT="Java AWT" border=0></a></H1>
<table width=515 border=0 cellpadding=0 cellspacing=0>
<tr>
<td width=172 align=left valign=top><A HREF="ch11_02.htm"><IMG SRC="gifs/txtpreva.gif" ALT="Previous" border=0></A></td>
<td width=171 align=center valign=top><B><FONT FACE="ARIEL,HELVETICA,HELV,SANSERIF" SIZE="-1">Chapter 11<br>Scrolling</FONT></B></TD>
<td width=172 align=right valign=top><A HREF="ch11_04.htm"><IMG SRC="gifs/txtnexta.gif" ALT="Next" border=0></A></td>
</tr>
</table>

&nbsp;
<hr align=left width=515>
</DIV>
<DIV CLASS=sect1>
<h2 CLASS=sect1><A CLASS="TITLE" NAME="JAWT-CH-11-SECT-3">11.3 The Adjustable Interface</A></h2>

<P CLASS=para>
<A NAME="CH11.ADJ1"></A><A NAME="CH11.ADJ2"></A>The <tt CLASS=literal>Adjustable</tt> interface is 
new to Java 1.1. It provides the method signatures required for an object 
that lets you adjust a bounded integer value. It is currently implemented 
by <tt CLASS=literal>Scrollbar</tt> and returned by 
two methods within <tt CLASS=literal>ScrollPane</tt>. 

<DIV CLASS=sect2>
<h3 CLASS=sect2><A CLASS="TITLE" NAME="JAWT-CH-11-SECT-3.1">Constants of the Adjustable Interface</A></h3>

<P CLASS=para>
There are two direction specifiers for <tt CLASS=literal>Adjustable</tt>. 

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><I CLASS=emphasis>public final static int HORIZONTAL <img src="gifs/bstar.gif" alt="(New)" border=0> </I><br>
<DD>

<P CLASS=para>
<tt CLASS=literal>HORIZONTAL</tt> is the constant 
for horizontal orientation. 

<p>
<DT CLASS=varlistentry><I CLASS=emphasis>public final static int VERTICAL <img src="gifs/bstar.gif" alt="(New)" border=0> </I><br>
<DD>

<P CLASS=para>
<tt CLASS=literal>VERTICAL</tt> is the constant for 
vertical orientation. </DL>
</DIV>

<DIV CLASS=sect2>
<h3 CLASS=sect2><A CLASS="TITLE" NAME="JAWT-CH-11-SECT-3.2">Methods of the Adjustable Interface</A></h3>

<DL CLASS=variablelist>
<DT CLASS=varlistentry><I CLASS=emphasis>public abstract int getOrientation () <img src="gifs/bstar.gif" alt="(New)" border=0> </I><br>
<DD>

<P CLASS=para>
The <tt CLASS=literal>getOrientation()</tt> method 
is for returning the current orientation of the adjustable object, either 
<tt CLASS=literal>Adjustable.HORIZONTAL</tt> or <tt CLASS=literal>Adjustable.VERTICAL</tt>. 

<P CLASS=para>
<tt CLASS=literal>setOrientation()</tt> is not part 
of the interface. Not all adjustable objects need to be able to alter orientation. 
For example, <tt CLASS=literal>Scrollbar</tt> instances 
can change their orientation, but each <tt CLASS=literal>Adjustable</tt> 
instance associated with a <tt CLASS=literal>ScrollPane</tt> 
has a fixed, unchangeable orientation. 

<p>
<DT CLASS=varlistentry><I CLASS=emphasis>public abstract int getVisibleAmount () <img src="gifs/bstar.gif" alt="(New)" border=0> </I><br>
<DD>

<P CLASS=para>
The <tt CLASS=literal>getVisibleAmount()</tt> method 
lets you retrieve the size of the visible slider of the adjustable object. 

<p>
<DT CLASS=varlistentry><I CLASS=emphasis>public abstract void setVisibleAmount (int amount) <img src="gifs/bstar.gif" alt="(New)" border=0> </I><br>
<DD>

<P CLASS=para>
The <tt CLASS=literal>setVisibleAmount()</tt> method 
lets you change the size of the visible slider to <tt CLASS=literal>amount</tt>. 

<p>
<DT CLASS=varlistentry><I CLASS=emphasis>public abstract int getValue () <img src="gifs/bstar.gif" alt="(New)" border=0> </I><br>
<DD>

<P CLASS=para>
The <tt CLASS=literal>getValue()</tt> method lets 
you retrieve the current value of the adjustable object. 

<p>
<DT CLASS=varlistentry><I CLASS=emphasis>public abstract void setValue (int value) <img src="gifs/bstar.gif" alt="(New)" border=0> </I><br>
<DD>

<P CLASS=para>
The <tt CLASS=literal>setValue()</tt> method lets 
you change the value of the adjustable object to <tt CLASS=literal>value</tt>. 

<p>
<DT CLASS=varlistentry><I CLASS=emphasis>public abstract int getMinimum () </I><br>
<DD>

<P CLASS=para>
The <tt CLASS=literal>getMinimum()</tt> method lets 
you retrieve the current minimum setting for the object. 

<p>
<DT CLASS=varlistentry><I CLASS=emphasis>public abstract void setMinimum (int minimum) <img src="gifs/bstar.gif" alt="(New)" border=0> </I><br>
<DD>

<P CLASS=para>
The <tt CLASS=literal>setMinimum()</tt> method lets 
you change the minimum value of the adjustable object to <tt CLASS=literal>minimum</tt>. 

<p>
<DT CLASS=varlistentry><I CLASS=emphasis>public abstract int getMaximum () <img src="gifs/bstar.gif" alt="(New)" border=0> </I><br>
<DD>

<P CLASS=para>
The <tt CLASS=literal>getMaximum()</tt> method lets 
you retrieve the current maximum setting for the object. 

<p>
<DT CLASS=varlistentry><I CLASS=emphasis>public abstract void setMaximum (int maximum) <img src="gifs/bstar.gif" alt="(New)" border=0> </I><br>
<DD>

<P CLASS=para>
The <tt CLASS=literal>setMaximum()</tt> method lets 
you change the maximum value of the adjustable object to <tt CLASS=literal>maximum</tt>. 

<p>
<DT CLASS=varlistentry><I CLASS=emphasis>public abstract int getUnitIncrement () <img src="gifs/bstar.gif" alt="(New)" border=0> </I><br>
<DD>

<P CLASS=para>
The <tt CLASS=literal>getUnitIncrement()</tt> method 
lets you retrieve the current line increment. 

<p>
<DT CLASS=varlistentry><I CLASS=emphasis>public abstract void setUnitIncrement (int amount) <img src="gifs/bstar.gif" alt="(New)" border=0> </I><br>
<DD>

<P CLASS=para>
The <tt CLASS=literal>setUnitIncrement()</tt> method 
lets you change the line increment amount of the adjustable object to <tt CLASS=literal>amount</tt>. 

<p>
<DT CLASS=varlistentry><I CLASS=emphasis>public abstract int getBlockIncrement () <img src="gifs/bstar.gif" alt="(New)" border=0> </I><br>
<DD>

<P CLASS=para>
The <tt CLASS=literal>getBlockIncrement()</tt> method 
lets you retrieve the current page increment. 

<p>
<DT CLASS=varlistentry><I CLASS=emphasis>public abstract void setBlockIncrement (int amount) <img src="gifs/bstar.gif" alt="(New)" border=0> </I><br>
<DD>

<P CLASS=para>
The <tt CLASS=literal>setBlockIncrement()</tt> method 
lets you change the paging increment amount of the adjustable object to 
<tt CLASS=literal>amount</tt>. 

<p>
<DT CLASS=varlistentry><I CLASS=emphasis>public abstract void addAdjustmentListener(AdjustmentListener listener) <img src="gifs/bstar.gif" alt="(New)" border=0> </I><br>
<DD>

<P CLASS=para>
The <tt CLASS=literal>addAdjustmentListener()</tt> 
method lets you register <tt CLASS=literal>listener</tt> 
as an object interested in being notified when an <tt CLASS=literal>AdjustmentEvent</tt> 
passes through the <tt CLASS=literal>EventQueue</tt> 
with this <tt CLASS=literal>Adjustable</tt> object 
as its target. 

<p>
<DT CLASS=varlistentry><I CLASS=emphasis>public abstract void removeAdjustmentListener(ItemListener listener) <img src="gifs/bstar.gif" alt="(New)" border=0> </I><br>
<DD>

<P CLASS=para>
The <tt CLASS=literal>removeAdjustmentListener()</tt> 
method removes <tt CLASS=literal>listener</tt> as 
a interested listener. If <tt CLASS=literal>listener</tt> 
is not registered, nothing happens. </DL>
</DIV>

</DIV>


<DIV CLASS=htmlnav>

<P>
<HR align=left width=515>
<table width=515 border=0 cellpadding=0 cellspacing=0>
<tr>
<td width=172 align=left valign=top><A HREF="ch11_02.htm"><IMG SRC="gifs/txtpreva.gif" ALT="Previous" border=0></A></td>
<td width=171 align=center valign=top><a href="index.htm"><img src='gifs/txthome.gif' border=0 alt='Home'></a></td>
<td width=172 align=right valign=top><A HREF="ch11_04.htm"><IMG SRC="gifs/txtnexta.gif" ALT="Next" border=0></A></td>
</tr>
<tr>
<td width=172 align=left valign=top>Scrolling An Image</td>
<td width=171 align=center valign=top><a href="index/idx_a.htm"><img src='gifs/index.gif' alt='Book Index' border=0></a></td>
<td width=172 align=right valign=top>ScrollPane</td>
</tr>
</table>
<hr align=left width=515>

<IMG SRC="gifs/smnavbar.gif" USEMAP="#map" BORDER=0> 
<MAP NAME="map"> 
<AREA SHAPE=RECT COORDS="0,0,108,15" HREF="../javanut/index.htm"
alt="Java in a Nutshell"> 
<AREA SHAPE=RECT COORDS="109,0,200,15" HREF="../langref/index.htm" 
alt="Java Language Reference"> 
<AREA SHAPE=RECT COORDS="203,0,290,15" HREF="../awt/index.htm" 
alt="Java AWT"> 
<AREA SHAPE=RECT COORDS="291,0,419,15" HREF="../fclass/index.htm" 
alt="Java Fundamental Classes"> 
<AREA SHAPE=RECT COORDS="421,0,514,15" HREF="../exp/index.htm" 
alt="Exploring Java"> 
</MAP>
</DIV>

</BODY>
</HTML>
